const express = require("express");
const router = express.Router();
const PageModel = require("../../../models/Page");
const { resData } = require("../../../utils/format");
const middleware_auth = require("../../../middleware/auth");
const middleware_permission = require("../../../middleware/permission");
const assert = require("http-assert");
module.exports = app => {
    /**
     * @apiGroup 管理端/页面管理
     * @api {get} /admin/api/page/getPageById 根据id获取页面详情
     */
    router.get("/getPageById", async (req, res) => {
        const { _id } = req.query;
        assert(_id, 400, "请传入id");
        const findResult = await PageModel.findOne({ _id });
        res.send(resData(findResult));
    });
    app.use("/admin/api/page", middleware_auth(), middleware_permission(), router);
};
